<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>前进</button>
    <button class="btn1">后退</button>
    <script>
        var btn = document.querySelector('button')
        btn.addEventListener('click',function(){
            // history.forward()
            history.go(1) // 前进一步
        })
        var btn1 = document.querySelector('.btn1')
        btn1.addEventListener('click', function(){
            // history.back()
            history.go(-1) // 后退一步
        })
    </script>
</body>
</html>